//
//  BRSelectCityRightCell.m
//  carcareIOS
//
//  Created by 王然 on 16/8/4.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "BRSelectCityRightCell.h"

#define CELL_HEIGHT (45)

#define TitltL_Color (COLOR_HEXSTRING(@"#424242"))

@interface BRSelectCityRightCell()

@property (nonatomic , strong) UILabel * titleL;

@property (nonatomic , strong) UIImageView * rightYesChoiceImageV;//右侧对号选择

@end

@implementation BRSelectCityRightCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createUI];
    }
    return self;
}
- (void)createUI
{
    CGFloat labelX = 12 * __MAIN_RATIO_375;
    
    UIImage * yesImage = ImageNamed(@"choiceCityRightImage");
    CGFloat yesIamgeVCenterX = SMALL_TABLEVIEW_WIDTH - yesImage.size.width / 2 - labelX;
    self.rightYesChoiceImageV = [[UIImageView imageViewWithCenter:CGPointMake(yesIamgeVCenterX, CELL_HEIGHT / 2) image:yesImage] setupOnView:self];
    [self.rightYesChoiceImageV setHidden:YES];
    
    CGFloat titleLW = SMALL_TABLEVIEW_WIDTH - yesImage.size.width - labelX * 3;
    self.titleL = [[UILabel labelWithFrame:CGRectMake(labelX, 0, titleLW, CELL_HEIGHT) font:FONT_DEFAULT_Light(15) text:@"" textColor:TitltL_Color] setupOnView:self];
    
    CGFloat lineX = 8 * __MAIN_RATIO_375;
    [[[UIView viewWithFrame:CGRectMake(lineX, CELL_HEIGHT , SMALL_TABLEVIEW_WIDTH - lineX , 0.5)] setupOnView:self] resetBackgroundColor:[Theme lineColor]];
}
- (BOOL)returnIsClick
{
    return !self.rightYesChoiceImageV.hidden;
}
- (void)reloadCellClickColor:(BOOL)isClick
{
    self.titleL.textColor = (isClick ? [Theme mainNavColor] :TitltL_Color);
    [self.rightYesChoiceImageV setHidden:!isClick];
}
- (void)reloadTitle:(NSString *)title isClick:(BOOL)isClick
{
    self.titleL.text = title;
    [self reloadCellClickColor:isClick];
}
+ (CGFloat)getCellHeight
{
    return CELL_HEIGHT;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
